package com.czl.module_storehouse.mvp.presenter;

import com.czl.base.data.bean.tengyun.CategoryBean;
import com.czl.base.data.bean.tengyun.SortBean;
import com.czl.module_base.http.HttpResponse;
import com.czl.module_base.mvp.presenter.BasePresenter;
import com.czl.module_base.mvp.view.SimpleView;
import com.czl.module_base.observer.AbsHandleSubscriber;
import com.czl.module_storehouse.mvp.model.CategoryModel;

import java.util.List;

/**
 * @author by xubin,
 * @date on 2022/2/11.
 * PS: Not easy to write code, please indicate.
 */
public class CategoryPresenter extends BasePresenter<CategoryModel, SimpleView> {

    public static final String TAG_CATEGORY_LIST = "category_list";

    public void getclassificationlistCompany() {
        getclassificationlistCompany(null);
    }

    public void getclassificationlistCompany(String propCompanyId) {
        doSubscribe2(mModel.getclassificationlistCompany(propCompanyId), new AbsHandleSubscriber<HttpResponse<List<CategoryBean>>>() {
            @Override
            public void onSuccess(HttpResponse<List<CategoryBean>> listHttpResponse) {
                listHttpResponse.setRequestTag(TAG_CATEGORY_LIST);
                mView.showHttpResponse(listHttpResponse);
            }
        });
    }

    public void getclassificationlistCompany(String propCompanyId, List<Integer> classStatus) {
        doSubscribe2(mModel.getclassificationlistCompany(propCompanyId, classStatus), new AbsHandleSubscriber<HttpResponse<List<CategoryBean>>>() {
            @Override
            public void onSuccess(HttpResponse<List<CategoryBean>> listHttpResponse) {
                listHttpResponse.setRequestTag(TAG_CATEGORY_LIST);
                mView.showHttpResponse(listHttpResponse);
            }
        });
    }

    public void getclassificationlistCompany(Integer companyId, SortBean sortBean, List<Integer> classStatus) {
        doSubscribe2(mModel.getclassificationlistCompany(companyId, sortBean, classStatus), new AbsHandleSubscriber<HttpResponse<List<CategoryBean>>>() {
            @Override
            public void onSuccess(HttpResponse<List<CategoryBean>> listHttpResponse) {
                listHttpResponse.setRequestTag(TAG_CATEGORY_LIST);
                mView.showHttpResponse(listHttpResponse);
            }
        });
    }

    public void getclassificationlistCompany(Integer companyId, String pIdPath, List<Integer> classStatus) {
        doSubscribe2(mModel.getclassificationlistCompany(companyId, pIdPath, classStatus), new AbsHandleSubscriber<HttpResponse<List<CategoryBean>>>() {
            @Override
            public void onSuccess(HttpResponse<List<CategoryBean>> listHttpResponse) {
                listHttpResponse.setRequestTag(TAG_CATEGORY_LIST);
                mView.showHttpResponse(listHttpResponse);
            }
        });
    }

    public void getClassStockList(Integer propCompanyId) {
        doSubscribe(mModel.getClassStockList(propCompanyId), new AbsHandleSubscriber<HttpResponse<List<CategoryBean>>>() {
            @Override
            public void onSuccess(HttpResponse<List<CategoryBean>> listHttpResponse) {
                mView.showHttpResponse(listHttpResponse);
            }
        });
    }
}
